<template>
  <div class="ai-predict-list">
    <div v-for="(item, i) in list" :key="i" class="ai-predict-item" @click="onItemClick(item)">
      <img class="ai-predict-icon" :src="item.icon" alt="flag" />
      <div class="ai-predict-info">
        <div class="ai-predict-name">{{ item.name }}</div>
        <div class="ai-predict-desc">{{ item.desc }}</div>
      </div>
      <div class="ai-predict-rate">
        <img :src="upIcon" class="ai-predict-up" alt="up" />
        <span>+{{ item.rate }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  list: {
    type: Array,
    required: true
  }
})
const upIcon = '/static/img/cHb_86f23530_Ecq.5b15710f.svg'
const emit = defineEmits(['itemClick'])
function onItemClick(item) {
  emit('itemClick', item)
}
</script>

<style scoped lang="scss">
.ai-predict-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 18px 0 0 0;
}
.ai-predict-item {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 18px 18px 18px 14px;
  position: relative;
}
.ai-predict-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 14px;
  background: #f5f5f5;
}
.ai-predict-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-predict-name {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-predict-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-predict-rate {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: #19C37B;
  margin-left: 10px;
}
.ai-predict-up {
  width: 18px;
  height: 18px;
  margin-right: 2px;
}
</style> 